package 其他.分积木;
import java.util.Scanner;
public class Main{
    public static void main(String args[]){
        Scanner sc = new Scanner(System.in);
        while(sc.hasNextLine()){
            int n = Integer.parseInt(sc.nextLine());
            int[] arr = new int[n];
            String [] ss = sc.nextLine().split(" ");
            for(int i =0; i<n; i++){
                arr[i] = Integer.parseInt(ss[i]);
            }
            String result = getResult(arr);
            System.out.println(result);
        }
    }
    public static String getResult(int [] arr){
        if(arr.length == 2 && arr[0] != arr[1]) return "NO";
        int min = arr[0];
        int sum = min;
        int temp = min;
        for(int i = 1; i<arr.length; i++){
            sum += arr[i];
            min = min< arr[i] ? min : arr[i];
            temp ^= arr[i];
        }
        if(temp != 0) {
            return "NO";
        }else{
            return String.valueOf(sum-min);
        }
    }
}